/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.epam.expertsys;

/**
 *
 * @author Admin
 */
public class Fact {

    private final String varName;
    private final String varValue;

    private Fact(String vName, String vValue) {

        varName = vName;
        varValue = vValue;

    }

    public static Fact create(String vName, String vValue)
            throws NullValueException {
        if ((vName == null) || (vValue == null)) {
            throw new NullValueException();
        }
        return new Fact(vName, vValue);
    }

    @Override
    public Fact clone() {
        return new Fact(this.varName, this.varValue);
    }

    @Override
    public boolean equals(Object checker) {
        Fact checker1 = (Fact) checker;
        return (checker1.getVarName().equals(this.varName)
                && checker1.getVarValue().equals(this.varValue));
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 83 * hash + (this.varName != null ? this.varName.hashCode() : 0);
        hash = 83 * hash + (this.varValue != null ? this.varValue.hashCode() : 0);
        return hash;
    }

    //setVarName
    public String getVarName() {
        return this.varName;
    }

    public String getVarValue() {
        return this.varValue;
    }
}
